@echo off
chcp 65001 > nul
setlocal enabledelayedexpansion
set "ports=7000 7001 7002 7003 7004 7005"
set "root_dir=D:\Program Files\Redis-x64-5.0.10\"

:: 遍历端口启动节点
for %%p in (%ports%) do (
    :: 定义节点目录（加双引号）
    set "node_dir=!root_dir!%%p"
    echo Starting node %%p: "!node_dir!"
    echo "cd /d "!node_dir!" && "!root_dir!redis-server.exe" "!node_dir!\redis.windows.conf""
    :: 核心修复：对redis-server.exe的路径添加双引号
    start "Redis-%%p" cmd /k "cd /d "!node_dir!" && "!root_dir!redis-server.exe" "!node_dir!\redis.windows.conf""
    :: 延迟启动，避免端口冲突
    timeout /t 0.5 /nobreak > nul
)

echo All Redis nodes started!
pause
